/**
 * @param {string} A
 * @param {string} B
 * @return {string[]}
 */
var uncommonFromSentences = function(A, B) {
  var merge = (A + " " + B).split(" ")
  var count = {}
  var res = {}
  merge.forEach(item => {
    if (count[item]) {
      count[item]++
      delete res[item]
    } else {
      count[item] = 1
      res[item] = 1
    }
  })
  return Object.keys(res)
}

console.log(uncommonFromSentences("apple this is sweet", "this apple is sour"))
console.log(uncommonFromSentences("apple apple", "banana"))
